
'use strict';

const Controller = require('egg').Controller;

class ListController extends Controller {

    async index() {
        const { ctx } = this;
        const list = await ctx.service.list.find();
        ctx.body = list;
    }
    async create() {
        const { ctx } = this;
        const params = await ctx.request.body; // 这一步获取提交的参数
        const list = await ctx.service.list.create(params);
        ctx.body = list;
    }
    async del() {
        const { ctx } = this;
        const params = await ctx.request.body; // 这一步获取提交的参数
        const list = await ctx.service.list.del(params);
        ctx.body = list;
    }
}

module.exports = ListController;
